<template>
  <div id="incident-list">
    <ul class="jsd-card-list">
      <li is="card" v-for="item of accidentData">
        <div class="jsd-card-title" slot="card-title">
          <time>{{item.accidentDate | formatDate}}</time>
          <span>打分表扣分：<strong>{{item.points}}</strong></span>
        </div>
        <ul class="jsd-card-body" slot="card-content">
          <li v-if="item.responsibility">
            <strong>责任：</strong>
            <span>{{item.responsibility}}</span>
          </li>
          <li v-if="item.illegalLevel">
            <strong>违规类型：</strong>
            <span>{{item.illegalLevel}}</span>
          </li>
          <li v-if="item.accidentType">
            <strong>事故类型：</strong>
            <span>{{item.accidentType}}</span>
          </li>
          <li v-if="item.bpAccidentType">
            <strong>BP事故类型分类：</strong>
            <span>{{item.bpAccidentType}}</span>
          </li>
        </ul>
      </li>
    </ul>
    <!--正在加载提示框-->
    <div is="loading" v-if="loadShow"></div>
    <!--加载失败弹框-->
    <div is="dialog-box" :message="dialogMessage" v-if="dialogShow" @close-dialog='closeDialog'></div>
    <div class="no_data" v-if="!accidentData.length">
      <i class="ion ion-ios-paper-outline"></i>
      <p>暂无数据</p>
    </div>
  </div>
</template>
<script type="text/javascript">
  // import '../../assets/css/incident_record.scss';
  import getInterface from '../../assets/js/insterface'
  import http from '../../assets/js/http_mixin'
  import card from '../../widget/card.vue'
  let accidentByYearUrl = getInterface.getAccidentByYearUrl;
  export default{
    data(){
      return {
        accidentData: []              // 事故信息
      }
    },
    mixins: [http],
    components: {
      card
    },
    mounted(){
      document.title = '事故记录';
      this.getInfo({
       url: accidentByYearUrl,
       param: {
       'empNo': this.$route.query.empNo
       },
       success: function (response) {
          console.log(response);
          if(response.data.resType == '00'){
            this.accidentData = response.data.data;
          }else{
            console.log(response.data.msg);
          }
       },
       fail: function (response) {
       this.dialogMessage = '请求失败，请稍后再试';
       this.dialogShow = true;
       }
       })
    }

  }
</script>